<template>
  <TinymceReadonly
    :modelValue="params.value"
    @click="onClick()"
    @dblclick="onDbClick()"
  />
</template>

<script lang="ts" setup>
import { ICellRendererParams } from 'ag-grid-community';

import TinymceReadonly from '@/components/tinymce/readonly.vue';

const props = defineProps<{
  params: ICellRendererParams;
}>();

function onClick() {
  props.params.api.setFocusedCell(
    props.params.node.rowIndex,
    props.params.colDef.field
  );
}

function onDbClick() {
  props.params.api.startEditingCell({
    rowIndex: props.params.node.rowIndex,
    colKey: props.params.colDef.field
  });
}
</script>
